<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>角动量守恒滑冰模拟器</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
        }

        .header p {
            font-size: 1.2em;
            opacity: 0.9;
        }

        .main-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
            padding: 30px;
        }

        .simulation-panel {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .controls {
            margin-bottom: 20px;
        }

        .control-group {
            margin-bottom: 15px;
        }

        .control-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
            color: #333;
        }

        .slider-container {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .slider {
            flex: 1;
            height: 6px;
            border-radius: 3px;
            background: #ddd;
            outline: none;
            -webkit-appearance: none;
        }

        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #667eea;
            cursor: pointer;
        }

        .value-display {
            min-width: 60px;
            text-align: center;
            font-weight: bold;
            color: #667eea;
        }

        .canvas-container {
            position: relative;
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
        }

        #simulationCanvas {
            border: 2px solid #e9ecef;
            border-radius: 10px;
            display: block;
            margin: 0 auto;
        }

        .data-panel {
            background: white;
            border-radius: 15px;
            padding: 25px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .formula-section {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
            text-align: center;
        }

        .formula {
            font-size: 1.5em;
            font-family: 'Times New Roman', serif;
            color: #2c3e50;
            margin: 10px 0;
        }

        .formula-highlight {
            background: #fff3cd;
            padding: 5px 10px;
            border-radius: 5px;
            font-weight: bold;
        }

        .metrics {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        .metric-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
        }

        .metric-value {
            font-size: 2em;
            font-weight: bold;
            margin-bottom: 5px;
        }

        .metric-label {
            font-size: 0.9em;
            opacity: 0.9;
        }

        .chart-container {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            height: 300px;
        }

        .action-buttons {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-top: 20px;
        }

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 25px;
            font-size: 1em;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-secondary {
            background: #6c757d;
            color: white;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        @media (max-width: 768px) {
            .main-content {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1><i class="fas fa-skating"></i> 角动量守恒滑冰模拟器</h1>
            <p>探索滑冰运动员如何通过收缩手臂改变旋转速度</p>
        </div>

        <div class="main-content">
            <div class="simulation-panel">
                <h2><i class="fas fa-play-circle"></i> 模拟控制</h2>
                
                <div class="controls">
                    <div class="control-group">
                        <label>初始角速度 (rad/s)</label>
                        <div class="slider-container">
                            <input type="range" id="initialOmega" class="slider" min="0.5" max="5" step="0.1" value="2">
                            <span class="value-display" id="initialOmegaValue">2.0</span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label>手臂伸展程度 (%)</label>
                        <div class="slider-container">
                            <input type="range" id="armExtension" class="slider" min="20" max="100" step="5" value="100">
                            <span class="value-display" id="armExtensionValue">100%</span>
                        </div>
                    </div>

                    <div class="control-group">
                        <label>质量分布 (kg·m²)</label>
                        <div class="slider-container">
                            <input type="range" id="massDistribution" class="slider" min="1" max="10" step="0.5" value="5">
                            <span class="value-display" id="massDistributionValue">5.0</span>
                        </div>
                    </div>
                </div>

                <div class="canvas-container">
                    <canvas id="simulationCanvas" width="400" height="400"></canvas>
                </div>

                <div class="action-buttons">
                    <button class="btn btn-primary" onclick="startSimulation()">
                        <i class="fas fa-play"></i> 开始模拟
                    </button>
                    <button class="btn btn-secondary" onclick="resetSimulation()">
                        <i class="fas fa-redo"></i> 重置
                    </button>
                </div>
            </div>

            <div class="data-panel">
                <h2><i class="fas fa-chart-line"></i> 物理数据</h2>
                
                <div class="formula-section">
                    <h3>角动量守恒公式</h3>
                    <div class="formula">
                        L = I × ω = <span class="formula-highlight" id="conservationValue">常数</span>
                    </div>
                    <p style="margin-top: 10px; color: #666;">
                        其中 L 为角动量，I 为转动惯量，ω 为角速度
                    </p>
                </div>

                <div class="metrics">
                    <div class="metric-card">
                        <div class="metric-value" id="angularMomentum">0.00</div>
                        <div class="metric-label">角动量 L (kg·m²/s)</div>
                    </div>
                    <div class="metric-card">
                        <div class="metric-value" id="momentOfInertia">0.00</div>
                        <div class="metric-label">转动惯量 I (kg·m²)</div>
                    </div>
                    <div class="metric-card">
                        <div class="metric-value" id="angularVelocity">0.00</div>
                        <div class="metric-label">角速度 ω (rad/s)</div>
                    </div>
                </div>

                <div class="chart-container">
                    <canvas id="dataChart" width="500" height="250"></canvas>
                </div>
            </div>
        </div>
    </div>

    <script src="simulation.js"></script>
</body>
</html>
